﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;

namespace YasharEl.Infrastructure.ExceptionHandling
{
    [ContractClass(typeof(ExceptionPolicyContract))]
    public interface IExceptionPolicy
    {
        bool HandleException(Exception exceptionToHandle);

        string PolicyName { get; }
    }

    [ContractClassFor(typeof(IExceptionPolicy))]
    internal abstract class ExceptionPolicyContract : IExceptionPolicy
    {
        public bool HandleException(Exception exceptionToHandle)
        {
            Contract.Requires<ArgumentNullException>(exceptionToHandle != null, "exceptionToHandle could not be null.");
            return default(bool);
        }

        public string PolicyName
        {
            get
            {
                return default(string);
            }
        }
    }
}
